package merisis.mirror;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;

import merisis.util.EncodeUtil;

public class CellArrangementStore {
	
	private File casDir;
	private int fileSize;

	/**
	 * 
	 * @param firstElem
	 *            the first cell serial number.
	 * @return the transient id to locate the found cell.
	 */
	public long nextCell(long firstElem) {
		return 0;
	}

	public ByteBuffer readCellBlock(long cellid) {

		return null;
	}

	public void writeCellBlock(long cellid, ByteBuffer block) {

	}

	public class DualElemCell {

		public long getTransientIdentifier() {
			return 0;
		}

		public long getFirstElement() {
			return 0;
		}

		public long getSecondElemet() {
			return 0;
		}

		public int getSize() {
			return 0;
		}

		public long getHeadPointOnEdge() {
			return 0;
		}

		public long getTailPointOnEdge() {
			return 0;
		}
	}
	
//	public void openHeadFile() throws IOException {
//
//		File fname = new File(casDir, EncodeUtil.encodeBase32(0, 8) + ".cas");
//
//		RandomAccessFile headfile = new RandomAccessFile(fname, "rw");
//		channel = datafile.getChannel();
//
//		if (datafile.length() == 0) {
//			ByteBuffer filehead = ByteBuffer.allocate(32);
//			byte[] head = new byte[byteLengthOfTrunkHead];
//			head[23] = (byte) 0xFF; // the end of head
//			filehead.put(head);
//			filehead.putLong(1);
//			filehead.flip();
//			channel.write(filehead);
//			channel.force(true);
//		}
//	}
}